package com.zengqingfa.shardingjdbc.demo.rest;

import com.zengqingfa.shardingjdbc.demo.entity.Bill;
import com.zengqingfa.shardingjdbc.demo.entity.BillDTO;
import com.zengqingfa.shardingjdbc.demo.entity.Dict;
import com.zengqingfa.shardingjdbc.demo.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @fileName: DictController
 * @author: zengqf3
 * @date: 2021-3-28 18:38
 * @description:
 */
@RequestMapping("/dict")
@RestController
public class DictController {


    @Autowired
    private DictService dictService;

    @PostMapping("/create")
    public int create(@RequestBody Dict dict) {
        int count = dictService.create(dict);
        return count;
    }

    @GetMapping("/selectByPrimary")
    public Dict selectByPrimary(@RequestParam("id") String id) {
        Dict dictResp = dictService.selectByPrimary(Long.valueOf(id));
        return dictResp;
    }
}
